#ifndef EntityManager_h__
#define EntityManager_h__
#include <map>
#include <cassert>
#include <list>

class BaseGameEntity;

//provide easy access
#define s_EntityManager EntityManager::Instance()


typedef std::map<int, BaseGameEntity*> EntityMap;
typedef std::list<BaseGameEntity*> EntityList;
class EntityManager
{
private:


	EntityMap m_EntityMap;

	EntityManager(){}

	//copy ctor and assignment should be private
	EntityManager(const EntityManager&);
	EntityManager& operator=(const EntityManager&);

public:

	static EntityManager* Instance();


	void            RegisterEntity(BaseGameEntity* NewEntity);


	BaseGameEntity* GetEntityFromID(int id)const;

	BaseGameEntity* CreateEntity(const char* type);

	EntityMap::const_iterator Begin();
	EntityMap::const_iterator End();

	void            RemoveEntity(BaseGameEntity* pEntity);

	//clears all entities
	void            Reset(){m_EntityMap.clear();}
};






#endif // EntityManager_h__